package com.zhixinhuixue.zsyte.xxx.ui.adapter;

import android.content.Context;
import android.util.Log;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.zhixinhuixue.zsyte.xxx.app.base.BaseFragment;
import com.zhixinhuixue.zsyte.xxx.ui.fragment.LoginFragment;
import com.zhixinhuixue.zsyte.xxx.ui.fragment.RegisterFragment;

import java.util.ArrayList;
import java.util.List;

public class MyViewPagerAdapter extends FragmentPagerAdapter {
    private List<String> titles = new ArrayList<String>();
    private List<BaseFragment> fragments = new ArrayList<>();
    public MyViewPagerAdapter(FragmentManager fm) {
        super(fm);

        titles.add("注册");
        titles.add("登录");
        fragments.add(new RegisterFragment());
        fragments.add(new LoginFragment());
    }

    @Override
    public Fragment getItem(int position) {
        Log.i("TAG", "initView: "+position);
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return titles.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position);
    }
}
